<%@ page language="java" import="com.newcrm.bean.*,com.newcrm.util.Util,com.newcrm.config.*,java.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
  String voipServerIP = request.getParameter("voipServerIP");
  String voipType = request.getParameter("voipType");
  if (voipType == null || voipType.length() == 0) {
    voipType = "gateway";
  }
  int callMode = 0;
  if (voipServerIP != null && voipServerIP.trim().length() > 0) {
    if (("ucpaas.qikebao.com").equals(voipServerIP)) {
      callMode = 1;
    } else  {
      callMode = 2;
    }
  }

  if (callMode == 2) {
%>
<script type="text/javascript" src="<%=request.getContextPath()%>/script/callcenter.js?ver=<%=Const.VERSION%>"></script>
<% } else if (callMode == 1) {
    if ("gateway".equals(voipType)) {
   // 使用SIP话机的模式
%>
<script type="text/javascript" src="<%=request.getContextPath()%>/script/ucpaassip.js?ver=<%=Const.VERSION%>"></script>
<%  } else { %>
<script type="text/javascript" src="<%=request.getContextPath()%>/sdk/yunUCSConnect.min.js?ver=<%=Const.VERSION%>"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/phone/js/yunzixun/demo.js?ver=<%=Const.VERSION%>"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/phone/js/yunzixun/demoClient.js?ver=<%=Const.VERSION%>"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/script/ucpaas.js?ver=<%=Const.VERSION%>"></script>
<%  }
  } else { %>
<script>
  $(function() {
    $("#phoneCall").click(function(e) {
      e.preventDefault();
      showVoipTipsPopup();
    });

    function showVoipTipsPopup() {
      //显示一个说明的对话框，告诉用户开通网络电话功能
      $.magnificPopup.open({
        modal: true,
        items: {
          src: '#voipTips-popup',
          type: 'inline'
        }
      });
    }
  });
</script>
<%
  }
%>
  <div id="voipTips-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">您还没有开通呼叫中心功能</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <p>您可以开通电话盒子和手机坐席功能</p>
      <ul>
        <li>1. 部署方便，使用既有线路，稳定</li>
        <li>2. 一键拨号，快捷，准确</li>
        <li>3. 通话记录统计，为电销管理做数据支撑</li>
        <li>4. 支持来电弹屏，第一时间了解潜在客户</li>
        <li>5. 上述两种方案均可实现隐号功能，有效保障企业客户资源，杜绝人为因素导致，客户外泄和流失</li>
      </ul>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a class="button blue small popup-close-button" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="inComing-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">来电弹屏</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <div class="">
        <table>
          <tr>
            <td width="60" valign="top"><img src="<%=request.getContextPath()%>/images/tel.png" width="48"></td>
            <td>
              <h3 id="inComing-phone"><h3>
              <div id="inComing-phone-detail"></div>
            </td>
          <tr>
        </table>
        <hr/>
        <h3>关联客户：</h3>
        <div id="phone-customer-list"></div>
      </div>
    </div>
  </div>